#pragma once
#include <stdint.h>

#define LCD03_ADDRESS 0xC6
#define LCD03_FIRMWARE 8

#define LCD03_CURSOR_HOME 1
#define LCD03_SET_CURSOR 2
#define LCD03_SET_CURSOR_LINE_COL 3
#define LCD03_HIDE_CURSOR 4
#define LCD03_SHOW_UNDERLINE_CURSOR 5
#define LCD03_SHOW_BLINKING_CURSOR 6
#define LCD03_BACKSPACE 8
#define LCD03_HORIZONTAL_TAB 9
#define LCD03_SMART_LINE_FEED 10
#define LCD03_VERTICAL_TAB 11
#define LCD03_CLEAR_SCREEN 12
#define LCD03_CARRIAGE_RETURN 13
#define LCD03_CLEAR_CLOUMN 17
#define LCD03_TAB_SET 18
#define LCD03_BACKLIGHT_ON 19
#define LCD03_BACKLIGHT_OFF 20

#define LCD03_LINE1 1
#define LCD03_LINE2 2
#define LCD03_LINE3 3
#define LCD03_LINE4 4

#define LCD03_LINE_START_POSITION 1

#ifndef HEX
	#define HEX 16
#endif
#ifndef DEC 
	#define DEC 10
#endif
#ifndef OCT
	#define OCT 8
#endif
#ifndef BIN
	#define BIN 2
#endif
extern uint8_t lcdInitialized;

uint8_t LCD03_isInitialized(void);

void LCD03_writeCommand(uint8_t cmd);

uint8_t LCD03_init(void);

void LCD03_clear(void);

void LCD03_clearPos(uint8_t line, uint8_t pos, uint8_t length);

void LCD03_writeChar(uint8_t ch);

void LCD03_writeStringLength(char *string, uint8_t length, uint8_t offset);

void LCD03_writeString(char *string);

void LCD03_writeFloat(float f);

void LCD03_writeNString_P(const char *pstring);

void _LCD03_showScreen(const char *line1, const char *line2);

void _LCD03_showScreen3(const char *line1, const char *line2, const char *line3);

void _LCD03_showScreen4(const char *line1, const char *line2, const char *line3, const char *line4);

#define LCD03_showScreen(__line1,__line2); ({_LCD03_showScreen((PSTR(__line1)),(PSTR(__line2)));})
	
#define LCD03_showScreen3(__line1,__line2,__line3); ({_LCD03_showScreen3((PSTR(__line1)),(PSTR(__line2)),(PSTR(__line3)));})
	
#define LCD03_showScreen4(__line1,__line2,__line3,__line4); ({_LCD03_showScreen4((PSTR(__line1)),(PSTR(__line2)),(PSTR(__line3)),(PSTR(__line4)));})

#define LCD03_writeString_P(__pstr) LCD03_writeNString_P((PSTR(__pstr)))

void LCD03_writeInteger(int16_t number, uint8_t base);

void LCD03_writeIntegerLength(int16_t number, uint8_t base, uint8_t length);

void LCD03_setCursorPos(uint8_t line, uint8_t pos);